<!--运行分享  官方策略、私有策略、商城策略  单币对策略 多币对策略--->
<template>
  <div class="bg">
    <div  class="bg" v-if="param">
      <LImage class="bg-image" :src="Config.img('celue_bg.png')"></LImage>
      <div class="title">
        <text class="font30 text1">{{T('Vtrading')}}</text>
        <div class="title-line"></div>
        <text class="font30 text1">{{T('策略交易')}}</text>
      </div>

      <div class="tag">
        <LImage class="tag-image" :src="Config.img('duihua_bg.png')"></LImage>
        <div class="tag-text">
          <text class="font36 lan tCenter all">{{'“'+T(tipe)+'”'}}</text>
        </div>
      </div>

      <div class="name">
        <text class="font48 text1 th67">{{T(param.name)}}</text>
        <text class="font26 lan th37">{{'['+T(param.code)+']'}}</text>
      </div>

      <div class="rate">
        <div class="row aend">
          <text :class="['font108', Config.upDownFont(param.totalRate)]">{{math.addJia(param.totalRate)}}</text>
          <text :class="['font68', Config.upDownFont(param.totalRate)]">{{'%'}}</text>
        </div>
        <text class="font24 lan th33">{{T('总收益率')}}</text>
      </div>

      <div class="data">
        
        <div class="data-value all">
          <div class="column">
            <text class="font24 lan th33">{{T('交易对')}}</text>
            <div class="height15"></div>
            <text class="font28 text1">{{T(param.pair)}}</text>
          </div>
        </div>

        <div class="line"></div>
        <div class="data-value all">
          <div class="column">
            <text class="font24 lan th33">{{T('执行时长')}}</text>
            <div class="height15"></div>
            <text class="font28 text1">{{param.time}}</text>
          </div>
        </div>

        <div class="line"></div>
        <div class="data-value all">
          <div class="column aend">
            <text class="font24 lan th33">{{T('年化收益率')}}</text>
            <div class="height15"></div>
            <text class="font28 text1">{{param.yearRate+'%'}}</text>
          </div>
        </div>
      </div>

      <div class="all"></div>
      <div class="info">
        <LImage class="logo" :src="Config.img('logo.png')"></LImage>
        <div class="column all">
          <text class="font24 text1">{{T('数字资产AI量化服务平台')}}</text>
          <text class="font22 text1">{{'Go with Vtrading to Victory'}}</text>
        </div>
        <div class="code-bg">
          <WeexQRCode v-if="inviteUrl" class="code" :code="inviteUrl"></WeexQRCode>
        </div>
      </div>
    </div>
  </div>
</template>

<script>

//功能
import modal from "@/_js/modal";
import math from "@/_js/math";
import Config from "@/_js/config";
import navigator from "@/_js/navigator";
import jhttps from "@/_js/https";

const weexFunction = weex.requireModule("WeexFunction");

import I18N from "@/_i18n/i18n";
var T = I18N.t;
export default {
  data() {
    return {
      T:T,
      math:math,
      Config:Config,
      param:undefined,
      inviteUrl:'',
      tipe:'',

      //type OFFICIAL平台，BUY商城，PRIVATE私有
      keys:['name', 'type', 'totalRate', 'time', 'yearRate', 'pair']
    };
  },

  mounted() {
    
    weexFunction.getConfig("onlySign",(value)=>{
      this.inviteUrl = value ? (Config.inviteUrl + value) : Config.inviteUrl;
    });

    Config.init(()=>{
      var param = navigator.getParam('param');
      for (let index = 0; index < this.keys.length; index++) {
        var key = this.keys[index];
        if (param[key] == null) {
          modal.toast('缺失：'+key);
          return true;
        }
      }

      if (param.type == 'OFFICIAL'  || param.type == 'FATHER') {
        param.code = '平台';
      } else if (param.type == 'PRIVATE') {
        param.code = '私有';
      }

      var tipes;
      var totalRate = math.getNumber(param.totalRate);
      if (totalRate < 0) {
        tipes = ['富贵险中求，浮亏算个球', '嗨～什么钱不钱的，重在参与', '经得起浮亏，耐得住暴富'];
      } else if (totalRate < 3) {
        tipes = ['我不贪，但我躺赚', '小手一抖，饭钱到手', '你刷会儿抖音的功夫我就赚钱了'];
      } else if (totalRate < 50) {
        tipes = ['风水轮流转，一言不合就是干！', '老司机神操作，请尽量模仿！', '系好安全带，收益速度实在快！'];
      } else   {
        tipes = ['是时候展现真正的技术了！', '无敌是多么寂寞', '别激动，小场面！'];
      }
      var num = Math.floor(Math.random() * 3);
      this.tipe = tipes[num];
      this.param = param;
    },[Config.OPT_UP_DOWN]);

    this.httpShareDaily();
  },

  methods: {

    //htt分享任务
    httpShareDaily() {
      var param = {'taskId':15};
      jhttps.postX("activity/addShareRecord",param,true,(data) => {});
    },
    
  }
}

</script>


<style src="@/_css/style.css"></style>
<style scoped>
.bg {
  background-color: #131C61;
  width: 750px;
  min-height: 1220px;
}
.title{
  flex-direction: row;
  align-items: center;
  margin-top: 90px;
  margin-left: 60px;
}
.title-line{
  width: 1px;
  height: 35px;
  margin-right: 16px;
  margin-left: 16px;
  background-color:#8BAEF7;
}
.bg-image{
  position: absolute;
  width: 534px;
  height: 696px;

  top: 405px;
  right: 0px;
}

/** 标签*/
.tag{
  flex-direction: row;
  justify-content: center;
  width: 682px;
  height: 166px;
  margin-top: 75px;
  margin-left: 34px;
}
.tag-text{
  margin-top: 43px;
  margin-left: 40px;
  margin-right: 40px;
}
.tCenter{
  text-align: center;
}
.tag-image{
  position: absolute;
  width: 682px;
  height: 166px;
}

/** 名称*/
.name{
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 680px;
  height: 107px;
  margin-top: 35px;
  margin-left: 35px;
}

/** 总收益率*/
.rate{
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  width: 680px;
  height: 163px;
  margin-left: 35px;
  margin-top: 95px;
}

/** 数据*/
.data{
  margin-top: 150px;
  width: 750px;
  flex-direction: row;
  align-items: center;
}
.data-value{
  flex-direction: row;
  justify-content: center;
  align-items: center;
  flex: 1;
}
.line{
  width: 1px;
  height: 71px;
  background-color:#192F7C;
}

/*信息*/
.info{
  flex-direction: row;
  align-items: center;
  background-color: #1A2B86;
  width: 750px;
  height: 150px;
}
.logo{
  width: 72px;
  height: 72px;
  margin-left: 50px;
  margin-right: 20px;
}

.code-bg{
  justify-content: center;
  align-items: center;
  background-color: #fff;
  width: 110px;
  height: 110px;
  margin-right: 50px;
  margin-left: 20px;
}
.code{
  width: 105px;
  height: 105px;
}


/**** 高度*/
.height15{
  height: 15px;
}
/****颜色*/
.lan{
  color:#0089F3;
}
</style>